﻿// 配置选项
using Chromely;
using Chromely.Browser;
using Chromely.Core;
using Chromely.Core.Configuration;
using Chromely.Core.Host;
using MyChromelyApp1.Utils;

/// <summary>
/// 自定义窗口类
/// </summary>
internal class NoteWindow : Window
{
    public NoteWindow(IChromelyNativeHost nativeHost,
        IChromelyConfiguration config,
        ChromelyHandlersResolver handlersResolver)
        : base(nativeHost, config, handlersResolver)
    {
        // 绑定事件
        FrameLoadStart += NoteWindow_FrameLoadStart;
    }


    /// <summary>
    /// 窗口加载事件
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    /// <exception cref="NotImplementedException"></exception>
    private void NoteWindow_FrameLoadStart(object? sender, FrameLoadStartEventArgs e)
    {
        // Console.WriteLine("窗口加载事件被调用.");

        // 目录是否存在，不存在则创建
        string localData = "local-data";
        if (!Directory.Exists(localData))
        {
            Directory.CreateDirectory(localData);
        }
    }
}